import request from '@/utils/request'

// 根据evaluationId获取商品评价列表
export function getAssessListByEvaluationId(evaluationId) {
  return request({
    url: '/assess/assess/user/product',
    method: 'get',
    params: { evaluationId }
  })
}

// 根据productId获取商品评价列表
export function getAssessListByProductId(productId) {
  return request({
    url: '/assess/assess/user/product',
    method: 'get',
    params: { productId }
  })
}

// 1. 管理员查看商品评价（分页+条件）
export function getAdminAssessList(data) {
  return request({
    url: '/assess/assess/admin',
    method: 'post',
    data
  })
}

// 2. 管理员查看商品附加评价（分页+条件）
export function getAdminAdditionPage(data) {
  return request({
    url: '/assess/assess/admin/getAddition',
    method: 'get',
    data
  })
}

// 3. 管理员隐藏商品评价
export function hideAdminAssess(data) {
  return request({
    url: '/assess/assess/admin',
    method: 'put',
    data
  })
}

// 4. 管理员删除商品评价
export function deleteAdminAssess(evaluationId) {
  return request({
    url: '/assess/assess/admin',
    method: 'delete',
    params: { evaluationId }
  })
}

// 5. 获取追评信息
export function getAdditionalsByEvaluationId(evaluationId) {
  return request({
    url: '/assess/assess/admin/getAddition',
    method: 'get',
    params: { evaluationId }
  })
}

// 获取评价的图片和视频
export function getAssessDetail(evaluationId) {
  return request({
    url: '/assess/assess/admin/assessDetail',
    method: 'get',
    params: { evaluationId }
  })
}

// 添加追评
export function addAdditionalAssess(data) {
  return request({
    url: '/assess/assess/user/add',
    method: 'post', // 应该为 post，但遵循后端
    data
  })
}

// 用户获取评价详情
export function getUserAssessDetail(evaluationId) {
  return request({
    url: '/assess/assess/admin/assessDetail',
    method: 'get',
    params: { evaluationId }
  })
}

// 用户删除自己的评价
export function deleteUserAssess(params) {
  return request({
    url: '/assess/assess/user',
    method: 'delete',
    params
  })
}

// 用户发表评价
export function addUserAssess(data) {
  return request({
    url: '/assess/assess/user',
    method: 'post',
    data
  })
} 